package com.sec.android.app.myfiles.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;

import com.sec.android.app.myfiles.MyFilesTestRunner;
import com.sec.android.app.myfiles.R;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;

/**
 * Created by jaebae on 2016-07-11.
 */
@RunWith(MyFilesTestRunner.class)
public class testDrawableMgr {
    Context mContext;

    @Before
    public void setUp() throws Exception {
        mContext = RuntimeEnvironment.application;
    }

    @Test
    public void testGetDrawable() {
        Drawable drawable = DrawableMgr.getDrawable(mContext, R.drawable.myfiles_list_music);
        Drawable drawable2 = DrawableMgr.getDrawable(mContext, R.drawable.myfiles_list_video);

        Assert.assertNotNull(drawable);
        Assert.assertNotNull(drawable2);
        Assert.assertNotSame(drawable, drawable2);

        Drawable cmp = DrawableMgr.getDrawable(mContext, R.drawable.myfiles_list_music);
        Assert.assertSame(drawable, cmp);
        cmp = DrawableMgr.getDrawable(mContext, R.drawable.myfiles_list_video);
        Assert.assertSame(drawable2, cmp);


        cmp = DrawableMgr.getDrawable(mContext, View.NO_ID);
        Assert.assertNull(cmp);
    }
}
